import App from './App'
import * as Pinia from 'pinia'

// 1. 引入你需要的组件
import {
    Popup,
    Tab,
    Tabs,
    Popover,
    Progress,
    Swipe,
    SwipeItem,
    Sticky,
    Sidebar,
    SidebarItem,
    Loading,
    Empty,
    Slider,
    Switch,
    Picker,
    ShareSheet,
    Rate,
    Icon,
    Dialog,
    Checkbox,
    CheckboxGroup,
    Cell,
    CellGroup,
    SwipeCell,
    Button
} from 'vant';
// 2. 引入组件样式
import 'vant/lib/index.css';

// #ifndef VUE3
Vue.config.productionTip = false
App.mpType = 'app'

const app = new Vue({
    ...App,
})
app.$mount()
// #endif

// #ifdef VUE3
import {
    createSSRApp
} from 'vue'


export function createApp() {
    // 创建app实例
    const app = createSSRApp(App)
    // 创建pinia实例
    const pinia = Pinia.createPinia()
    // 使用pinia
    app.use(pinia)

    // 使用vant组件
    app.use(Tab)
        .use(Popup)
        .use(Popover)
        .use(Tab)
        .use(Progress)
        .use(Tabs)
        .use(Swipe)
        .use(SwipeItem)
        .use(Sticky)
        .use(Sidebar)
        .use(SidebarItem)
        .use(Loading)
        .use(Empty)
        .use(Slider)
        .use(Switch)
        .use(Picker)
        .use(ShareSheet)
        .use(Rate)
        .use(Icon)
        .use(Dialog)
        .use(Checkbox)
        .use(CheckboxGroup)
        .use(Cell)
        .use(CellGroup)
        .use(SwipeCell)
        .use(Button);
    return {
        app
    }
}
// #endif
